package com.lzh.others.basejava.Thread_21;

import org.jetbrains.annotations.NotNull;

import java.util.concurrent.ThreadFactory;

/**
 * @Classname DaemonThreadFactory
 * @Description 通过实现的ThreadFactory接口 可以定制由Executor创建的线程的属性（后台，优先级，名称）
 * @Date 2021/9/14 14:27
 * @Created by liuzihao
 */
public class DaemonThreadFactory implements ThreadFactory {

    @Override
    public Thread newThread(@NotNull Runnable r) {
            Thread t = new Thread(r);
            t.setDaemon(true);
            return t;
    }
}
